import {httpDelete, httpGet, httpPageableGet, httpPost} from '@/utils/request'


export async function list( params?:any ){
  const { data,success }  = await httpPageableGet('/api/v1/user/list',params)
  return  { data,success };
}

export async function currUser(  ){
  const { data,success }  = await httpGet('/api/v1/user/currUser')
  return  { data,success };
}

export async function info( id?:number ){
  const { data,success }  = await httpGet(`/api/v1/user/info/${id}`)
  return  { data,success };
}

export async function logout( params?:any ){
  const { code }  = await httpGet('/api/v1/user/logout',params)
  return code === 200;
}

export async function create( params?:any ){
  const { code }  = await httpPost('/api/v1/user/addUser',params)
  return code === 200;
}

export async function login( params?:any ){
  const  {code,msg}  = await httpPost('/api/v1/user/login',params)
  return  {code,msg};
}

export async function modify( params?:any ){
  const { code }  = await httpPost('/api/v1/user/editUser',params)
  return code === 200;
}

export async function deleteById( userId:any ){
  const { code }  = await httpDelete(`/api/v1/user/delete/${userId}` )
  return code === 200;
}

